package com.share.example.sbsjw.algorithm;

import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm;
import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue;

import java.util.Collection;

//范围的分片算法类名称，用于BETWEEN
@Slf4j
public class LongInAlgorithm implements PreciseShardingAlgorithm<Long> {
    @Override
    public String doSharding(Collection<String> collection, PreciseShardingValue<Long> pre) {
        String realtable = AllTableConfig.getPhysicsTableName(pre.getLogicTableName(), pre.getValue());
        log.debug("分表的信息columnName={},value={},logicTableName={},realtable={}", pre.getColumnName(), pre.getValue(), pre.getLogicTableName(), realtable);
        return realtable;
    }
}



